using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Asns
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("Asn")]
    [Route("api/basic-archives/asn")]
    public partial class AsnController : BasicArchivesController, IAsnAppService
    {
        protected IAsnAppService AsnAppService => LazyServiceProvider.LazyGetRequiredService<IAsnAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<AsnDto> GetAsync(Guid id)
        {
            return AsnAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("child/{id}")]
        public Task<AsnLineDto> GetChildAsync(Guid id)
        {
            return AsnAppService.GetChildAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<AsnDto> FindAsync(string filter)
        {
            return AsnAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<AsnDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return AsnAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<AsnDto>> GetListAsync(FilterRequestDto input)
        {
            return AsnAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<AsnDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return AsnAppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("query-children")]
        public Task<PagedResultDto<AsnLineDto>> QueryChildrenAsync(FilterGroupRequestDto input)
        {
            return AsnAppService.QueryChildrenAsync(input);
        }

        [HttpPost]
        public Task<AsnDto> CreateAsync(AsnCreateDto input)
        {
            return AsnAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<AsnDto> UpdateAsync(Guid id, AsnUpdateDto input)
        {
            return AsnAppService.UpdateAsync(id, input);
        }

        [HttpPost]
        [Route("submit")]
        public Task<AsnDto> SubmitAsync(Guid id)
        {
            return AsnAppService.SubmitAsync(id);
        }

        [HttpPost]
        [Route("approve")]
        public Task<AsnDto> ApproveAsync(Guid id)
        {
            return AsnAppService.ApproveAsync(id);
        }

        [HttpPost]
        [Route("unapprove")]
        public Task<AsnDto> UnApproveAsync(Guid id)
        {
            return AsnAppService.UnApproveAsync(id);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return AsnAppService.DeleteAsync(id);
        }

        [HttpPost]
        [Route("batch-create")]
        public Task<List<AsnDto>> BatchCreateAsync(List<AsnCreateDto> inputs, bool useBulk = false)
        {
            return AsnAppService.BatchCreateAsync(inputs, useBulk);
        }

        [HttpPut]
        [Route("batch-update")]
        public Task<List<AsnDto>> BatchUpdateAsync(List<AsnBatchUpdateDto> inputs, bool useBulk = false)
        {
            return AsnAppService.BatchUpdateAsync(inputs, useBulk);
        }

        [HttpPost]
        [Route("batch-delete")]
        public Task BatchDeleteAsync(List<Guid> ids, bool useBulk = false)
        {
            return AsnAppService.BatchDeleteAsync(ids, useBulk);
        }
    }
} 